package com.zjzywl.iotSendthings.repository1;

import java.util.List;





import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;


import com.zjzywl.iotSendthings.entity1.KSSRYJBXXB;

import com.zjzywl.iotSendthings.entity1.KSSRYBDXXB;
import com.zjzywl.iotSendthings.entity1.RYJBXXB;
import com.zjzywl.iotSendthings.util.Prisoner;



@Repository
public interface PrisonerRepository extends JpaRepository<RYJBXXB,String> {
	/*@Query("select u.zp from Prisoner u where u.sfz=:sfz")
	byte[] getOne(@Param("sfz")String sfz);*/
	@Query(value="select a from RYJBXXB a where a.zjhm=:zjhm  order by a.sjc desc")
	List<RYJBXXB> getName(@Param("zjhm")String zjhm); 
	
	@Query(value="select * from RYJBXXB where xm=:xm and rownum=1",nativeQuery=true)
	RYJBXXB getInfoByName(@Param("xm")String xm);
	
	@Query("select a from KSSRYJBXXB a  where a.jbxxbh=:jbxxbh")
	KSSRYJBXXB getJsh(@Param("jbxxbh")String jbxxbh);
	
	@Query("select a from KSSRYBDXXB a  where a.rybh=:rybh")
	KSSRYBDXXB getRssj(@Param("rybh")String rybh);
	
	@Query("select a from RYJBXXB a  where a.jbxxbh=:jbxxbh")
	RYJBXXB getZjhm(@Param("jbxxbh")String jbxxbh);
	
	@Query("select a from KSSRYJBXXB a  where a.rybh=:rybh")
	KSSRYJBXXB getByJsh(@Param("rybh")String rybh);
	@Query("select a from KSSRYJBXXB a  where a.jbxxbh=:jbxxbh")
    KSSRYJBXXB getByJbxxbh(@Param("jbxxbh")String jbxxbh);
	
}